package oj;

import java.util.Arrays;
import java.util.Scanner;

public class Day14幸运的袋子 {
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        while(sc.hasNext()){
            int n=sc.nextInt();
            int[] arr=new int[n];
            for(int i=0;i<n;i++){
                arr[i]=sc.nextInt();
            }
            Arrays.sort(arr);
            System.out.println(dfs(0,0,1,arr,n));
        }
    }
    private static int dfs(int index,int sum,long mul,int[] arr,int n){
        int res=0;
        for(int i=index;i<n;i++){
            sum+=arr[i];
            mul*=arr[i];
            if(sum>mul){
                res+=1+dfs(i+1,sum,mul,arr,n);
            }else if(arr[i]==1){
                res+=dfs(i+1,sum,mul,arr,n);
            }else{
                break;
            }
            sum-=arr[i];
            mul/=arr[i];
            while(i<n-1 && arr[i]==arr[i+1]){
                i++;
            }
        }
        return res;
    }
}
